/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author alberto
 */
@Entity
@Table(name = "RecetasInsumos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RecetasInsumos.findAll", query = "SELECT r FROM RecetasInsumos r"),
    @NamedQuery(name = "RecetasInsumos.findByIdreceta", query = "SELECT r FROM RecetasInsumos r WHERE r.idreceta = :idreceta"),
    @NamedQuery(name = "RecetasInsumos.findByCantidad", query = "SELECT r FROM RecetasInsumos r WHERE r.cantidad = :cantidad")})
public class RecetasInsumos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDRECETA")
    private Integer idreceta;
    @Size(max = 45)
    @Column(name = "CANTIDAD")
    private String cantidad;
    @JoinColumn(name = "IDRECETA", referencedColumnName = "IDRECETA", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Recetas recetas;
    @JoinColumn(name = "IDINSUMO", referencedColumnName = "IDINSUMO")
    @ManyToOne(optional = false)
    private Insumos idinsumo;

    public RecetasInsumos() {
    }

    public RecetasInsumos(Integer idreceta) {
        this.idreceta = idreceta;
    }

    public Integer getIdreceta() {
        return idreceta;
    }

    public void setIdreceta(Integer idreceta) {
        this.idreceta = idreceta;
    }

    public String getCantidad() {
        return cantidad;
    }

    public void setCantidad(String cantidad) {
        this.cantidad = cantidad;
    }

    public Recetas getRecetas() {
        return recetas;
    }

    public void setRecetas(Recetas recetas) {
        this.recetas = recetas;
    }

    public Insumos getIdinsumo() {
        return idinsumo;
    }

    public void setIdinsumo(Insumos idinsumo) {
        this.idinsumo = idinsumo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idreceta != null ? idreceta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RecetasInsumos)) {
            return false;
        }
        RecetasInsumos other = (RecetasInsumos) object;
        if ((this.idreceta == null && other.idreceta != null) || (this.idreceta != null && !this.idreceta.equals(other.idreceta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.RecetasInsumos[ idreceta=" + idreceta + " ]";
    }
    
}
